import { createApp } from 'vue'
import App from './App.vue'

import pinia from './stores'

import router from './router'

// 引入element-plus组件与样式
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

//引入element-plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 全局样式
import '@/styles/index.scss'

// 引入icon图标库
import 'virtual:svg-icons-register'

// 中文包
import zhCn from 'element-plus/es/locale/lang/zh-cn'

//鉴权
import './permission'

// 创建一个应用
const app = createApp(App)

//element-plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.use(pinia)

// 引入自定义全局组件
import gloablComponent from '@/components'
app.use(gloablComponent)

// 安装element-plus插件
app.use(ElementPlus, {
    locale: zhCn,
})

app.use(pinia)
app.use(router)

// 挂载
app.mount('#app')
